var t,
  a = require("../../@babel/runtime/helpers/defineProperty"),
  e = require("../../res/www.a9a.cn.js"),
  i = getApp(),
  n = 2,
  o = !0;
Page({
  data: {
    triggered: !0,
    loading_flag: !1,
    loading_ico_flag: !1,
    loading_str: "玩命加载中",
  },
  onLoad: function (t) {
    var a = this;
    i.get_config("_ZEAI").then(function (t) {
      a.setData({ color: i._ZEAI.color, rgbcolor: e.c16_rgb(i._ZEAI.color) });
    }),
      i.get_navigationBarTopHeight(this),
      i.get_openid().then(function (t) {
        a.init();
      });
  },
  init: function () {
    var e = this;
    wx.showLoading({ title: "玩命加载中...", mask: !0 }),
      wx.showNavigationBarLoading(),
      (o = !1),
      (t = wx.getStorageSync("COOK_U")),
      i.ajax({
        url: "anli.php",
        data: { submitok: "list", openid: t.openid },
        success: function (t) {
          wx.setNavigationBarTitle({ title: t.nTitle }),
            e.setData({ banner: t.banner, nTitle: t.nTitle, SHARE: t.SHARE }),
            1 == t.flag
              ? 0 == t.LIST.length
                ? e.setData({ LIST: [], li_nodata: !0 })
                : e.setData(a({}, "LIST[0]", t.LIST))
              : wx.showToast({ title: t.msg, icon: "none", mask: !0 }),
            (o = !0),
            wx.hideLoading(),
            wx.hideNavigationBarLoading();
        },
      });
  },
  zoom9Fn: function (t) {
    var a = t.currentTarget.dataset.cur;
    a = a.replace("_s.", "_b.");
    var i = t.currentTarget.dataset.idx,
      n = t.currentTarget.dataset.idx2,
      o = this.data.LIST[i][n].piclist.map(function (t, a) {
        return t.replace("_s.", "_b.");
      });
    e.empty(a) || wx.previewImage({ current: a, urls: o });
  },
  uidFn: function (t) {
    var a = t.currentTarget.dataset.uid;
    wx.navigateTo({ url: "../u/u?uid=" + a });
  },
  agreeFn: function (n) {
    var o = this,
      r = n.currentTarget.dataset.idx,
      s = n.currentTarget.dataset.idx2,
      l = n.currentTarget.dataset.id;
    i.chklogin().then(function (n) {
      n
        ? ((t = wx.getStorageSync("COOK_U")),
          i.ajax({
            url: "anli.php",
            data: { submitok: "ajax_agree", tid: l, openid: t.openid },
            success: function (t) {
              if (1 == t.flag) {
                var i,
                  n = o.data.LIST[r][s].agree.ulist.length;
                o.setData(
                  (a((i = {}), "LIST[" + r + "][" + s + "].agree.fly", "block"),
                  a(i, "LIST[" + r + "][" + s + "].agree.class", " ed"),
                  a(i, "LIST[" + r + "][" + s + "].agree.num", t.num),
                  a(i, "LIST[" + r + "][" + s + "].agree.ulist[" + n + "]", {
                    uid: t.uid,
                    photo_s_url: t.photo_s_url,
                  }),
                  i)
                );
              } else (t.this = o), (t.url = "no"), e.sorry(t);
            },
          }))
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  onPullDownRefresh: function () {
    var t = this;
    wx.vibrateShort({ type: "heavy" }),
      setTimeout(function () {
        t.setData({
          triggered: !1,
          loading_flag: !1,
          loading_str: "玩命加载中",
          LIST: [],
          li_nodata: !1,
        }),
          t.setloading("end", "玩命加载中"),
          (n = 2),
          t.init();
      }, 500);
  },
  setloading: function (t, a) {
    "start" == t
      ? this.setData({ loading_flag: !0, loading_ico_flag: !0, loading_str: a })
      : this.setData({
          loading_flag: !1,
          loading_ico_flag: !1,
          loading_str: a,
        });
  },
  onReachBottom: function () {
    var e = this.data.LIST,
      r = this;
    if (o) {
      (o = !1), r.setloading("start", "玩命加载中");
      var s = { submitok: "list", p: n, openid: t.openid };
      i.ajax({
        url: "anli.php",
        data: s,
        success: function (t) {
          if (1 == t.flag) {
            var i = e.length;
            if (t.LIST.length < 1)
              return r.setloading("end", "已全部加载完毕"), void (o = !1);
            r.setData(a({}, "LIST[" + i + "]", t.LIST)), (n += 1), (o = !0);
          } else wx.showToast({ title: t.msg, icon: "none", mask: !0 });
          r.setloading("end", "上拉加载更多");
        },
      });
    }
  },
  binnd_scroll: function (t) {
    t.detail.scrollTop > 100
      ? this.setData({ backtop_flag: !0 })
      : this.setData({ backtop_flag: !1 });
  },
  backtopFn: function (t) {
    var e = "scrolltopNum_" + t.currentTarget.dataset.id;
    this.setData(a({}, e, 0));
  },
  onShareAppMessage: function () {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.content,
      path: "/pages/anli/anli",
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.content,
      query: "",
      path: "/pages/anli/anli",
    };
  },
});
